/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mortbay.jetty.pico.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Hnmtuan
 */
@Entity
@Table(name = "images")
@NamedQueries({
    @NamedQuery(name = "Images.findAll", query = "SELECT i FROM Images i"),
    @NamedQuery(name = "Images.findByIdImages", query = "SELECT i FROM Images i WHERE i.idImages = :idImages"),
    @NamedQuery(name = "Images.findByImageUrl", query = "SELECT i FROM Images i WHERE i.imageUrl = :imageUrl"),
    @NamedQuery(name = "Images.findByImageState", query = "SELECT i FROM Images i WHERE i.imageState = :imageState"),
    @NamedQuery(name = "Images.findByIsMain", query = "SELECT i FROM Images i WHERE i.isMain = :isMain")})
public class Images implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IdImages")
    private String idImages;
    @Column(name = "ImageUrl")
    private String imageUrl;
    @Column(name = "ImageState")
    private Integer imageState;
    @Column(name = "IsMain")
    private Boolean isMain;
    @JoinColumns({
        @JoinColumn(name = "Item", referencedColumnName = "IdItem"),
        @JoinColumn(name = "Category", referencedColumnName = "Category")})
    @ManyToOne(optional = false)
    private Item item;

    public Images() {
    }

    public Images(String idImages) {
        this.idImages = idImages;
    }

    public String getIdImages() {
        return idImages;
    }

    public void setIdImages(String idImages) {
        this.idImages = idImages;
    }

    public String getImageUrl() {
        return imageUrl;
    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public Integer getImageState() {
        return imageState;
    }

    public void setImageState(Integer imageState) {
        this.imageState = imageState;
    }

    public Boolean getIsMain() {
        return isMain;
    }

    public void setIsMain(Boolean isMain) {
        this.isMain = isMain;
    }

    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idImages != null ? idImages.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Images)) {
            return false;
        }
        Images other = (Images) object;
        if ((this.idImages == null && other.idImages != null) || (this.idImages != null && !this.idImages.equals(other.idImages))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.mortbay.jetty.pico.entities.Images[idImages=" + idImages + "]";
    }

}
